home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 23
/
Amiga Format AFCD23 (Feb 1998, Issue 107).iso
/
-seriously_amiga-
/
shareware
/
programming
/
other
/
iff-rgfx
/
rgfx-chunks.doc
< prev
next >
Wrap
Text File
|
1997-12-12
|
9KB
|
276 lines
$VER: RGFX-Chunks.doc 1.2 (7.12.97)
A typical structure of a RGFX file (recommended) :
FORM-RGFX
RGHD Image Header
RSCM Screenmode information
RCOL Color and transparency information
RBOD The Graphics itself
Additional (optional) chunks should appear somewhere
between RCOL and RBOD.
RGFX - Basic chunks
===================
RGHD - RawGfx Bitmap Header
---------------------------
** This one replaces BMHD
struct RGHD
{
ULONG rgfx_LeftEdge; /* (see BMHD) */
ULONG rgfx_TopEdge; /* (see BMHD) */
ULONG rgfx_Width; /* (see BMHD) */
ULONG rgfx_Height; /* (see BMHD) */
ULONG rgfx_PageWidth; /* (see BMHD) */
ULONG rgfx_PageHeight; /* (see BMHD) */
ULONG rgfx_Depth; /* 1-8 for RMBT_BYTEPLANAR8,
1-8 for RMBT_BYTECHUNKY8,
24 for RMBT_3BYTERGB24 */
ULONG rgfx_PixelBits; /* 1-8 for RMBT_BYTEPLANAR8,
8 for RMBT_BYTECHUNKY8,
24 for RMBT_3BYTERGB24 */
ULONG rgfx_BytesPerLine; /* (width+7)/8 for RMBT_BYTEPLANAR8,
width for RMBT_BYTECHUNKY8,
width*3 for RMBT_3BYTERGB24 */
ULONG rgfx_Compression; /* RCMP_ type flag */
ULONG rgfx_XAspect; /* (see BMHD) */
ULONG rgfx_YAspect; /* (see BMHD) */
ULONG rgfx_BitMapType; /* RBMT_ type flag */
};
If you encounter unknown depth/pixelbits/bytesperline combinations,
then do reject these (future expansions). But so far, only use
the legally defined ones yourself ! Don't define own formats,
e.g. for 16 Bit or for BGR !
#define RCMT_NOCOMPRESSION (0L)
#define RCMT_XPK (1L)
#define RMBT_BYTEPLANAR8 (0L) /* unaligned planar 8 bit bitmap */
#define RMBT_BYTECHUNKY8 (1L) /* unaligned chunky 8 bit bitmap */
#define RMBT_3BYTERGB24 (2L) /* 3-byte 24 bit RGB triples */
BYTEPLANAR8 data is similar to a regular bitmap (or an ABIT data chunk),
with the exeception, that no alignment, i.e. to word boundaries, does
take place - in general, we don't make use of alignment.
RSCM - RawGfx ScreenMode
------------------------
** This one replaces CAMG.
The default setting is:
rscm_AGA: default screenmode
rscm_CGfx: INVALID_ID
rscm_P96: INVALID_ID
if ModeNotAvailable( rscm_P96 ) does return an error,
then try ModeNotAvailable( rscm_CGfx ) - on error,
then try ModeNotAvailable( rscm_AGA ).
Use the first ID, which is available, otherwise compute
one yourself by using BestModeID()
Note: Since HAM modes only can be identified by their
ID, you should make sure, tht CGfx/P96 are set
to INVALID_ID and that AGA is OR'ed with HAM_KEY
for these modes.
For EHB, you should make sure, that the AGA viewmode
field is OR'ed with EXTRAHALFBRITE_KEY - if you want
to keep that feature with the graphics. Please also
see colormap notes for EHB.
(see <graphics/modeid.h>)
struct RSCM
{
ULONG rscm_AGA; /* 32 Bit AGA Viewmode ID */
ULONG rscm_CGfx; /* 32 Bit CGfx Viewmode ID */
ULONG rscm_P96; /* 32 Bit P96 Viewmode ID */
};
RCOL - RawGfx Colormap
----------------------
** This one replaces CMAP,
Required with RMBT_BYTEPLANAR8 and RMBT_BYTECHUNKY8,
and optionally allowed with RMBT_3BYTERGB24 for use
as a dithering destination colormap.
Stored are 256 byte triples in RGB format. Note, that
full-range values (0..255) have to be stored.
Sample: rcol_Colors[0][0] = 0..255 red value, color #0 (1st)
rcol_Colors[0][1] = 0..255 green value, color #0
rcol_Colors[0][2] = 0..255 blue value, color #0
...
rcol_Colors[255][0] = 0..255 red value, color #255 (256th)
rcol_Colors[255][1] = 0..255 green value, color #255
rcol_Colors[255][2] = 0..255 blue value, color #255
Unused entries should be filled with zeroes.
struct RCOL
{
ULONG rcol_TransColor; /* boolean: is there a transparent color ? */
ULONG rcol_TransColorNum; /* yes, it's number ... from the ones below */
UBYTE rcol_Colors[256][3];
};
Allowed boolean values: TRUE (1L) and FALSE (0L)
Note: With EHB mode, which e.g. uses 64 colors with only a 32 color
palette, you always should store the full color range within
the RCOL structure: if someone is going to display EHB pictures
on an RTG screen, he won't have to calculate the 'missing'
colors by himself.
RBOD - RawGfx Bitmap Body
-------------------------
** This one replaces BODY
May look like:
struct RBOD
{
UBYTE rbod_XPK[3]; ** containing 'XPK'
UBYTE rbod_BitMap[];
};
Or simply:
struct RBOD
{
UBYTE rbod_BitMap[];
};
This has not been defined as a union structure here, since some
compilers may add unrequested pad bytes to the structure.
You should reference this chunk as an UBYTE array, only.
RGFX - Optional chunks
======================
RXYA - Viewable XY-Area
-----------------------
** based on an idea by Peter Bornhall <bornhall@swipnet.se>
It may be useful to specify a small "view area" fromout
a larger image, e.g. a 320x200 area inside a 2048x2048
image.
struct RXYA
{
ULONG xy_LeftEdge;
ULONG xy_TopEdge;
ULONG xy_Width;
ULONG xy_Height;
};
RXXX - Image Rating
-------------------
** based on an idea by Peter Bornhall <bornhall@swipnet.se>
Not all images may be suitable for any group of recepients.
struct RXXX
{
ULONG xxx_Rating; /* e.g. for parents who want to control access */
};
#define RXXX_HARMLESS (0L) /* this image won't affect anyone (e.g. cliparts) */
#define RXXX_PARENTAL_ADVISORY (1L) /* some people may feel offended by this (e.g. violent comics) */
#define RXXX_OFFENSIVE (2L) /* most people will feel offended by this (whatever) */
RALH - Alpha Channel Header
---------------------------
** based on an idea by Marcel Offermans <M.Offermans@CBi.CentraalBeheer.NL>
We support three different types of Alpha channels:
- operating on a colormap (with upto 8 bit images only, and
only, if MORE than one color should be transparent, i.e.
when RCOL.rcol_TransColor does not suffice). Like with RCOL,
the supplied table should be sized for 256 colors always, thus
any unused entries should be set to zero (= fully transparent).
- operating on separate pixels (with any bitdepth),
supplying a width*height area of 0..255 values for
each pixel (or component), where 0 means "fully transparent"
and 255 means "not transparent at all"
We also allow to differ between "complete" transparency and
"color component specific" transparency, i.e. you either may apply
the transparency to the whole RGB value of the color/pixel OR to each one
of the RGB color components separately (which means 3 times as much data).
This works with colormaps as well as pixelmaps.
Examples: - transparent colormap, for whole color
256 entries, each one ranged 0..255
[ size: 256 bytes ]
- transparent colormap, for color components
256 triple entries, means
three sub entries ranged 0..255 (for R, G and B)
[ size: 768 bytes ]
- transparent pixelmap, for whole 8/24 Bit pixels
<width> x <height> entries, each one
ranged 0..255
[ size: width x height ]
- transparent pixelmap, for RGB components 8/24 Bit pixels
<width> x <height> entries, means each pixel with
three sub entries ranged 0..255 (for R, G and B)
[ size: width x height x 3 ]
This may not be practical for most uses, since it
will double the space needed for a 24 bit graphics
and will need four times the space for a 8 bit graphics.
struct RALH
{
ULONG ralh_AlphaType; /* the type of alpha channel - colormap (8 bit) */
/* or pixelmap (8/24 bit) */
ULONG ralh_TransparencyType; /* Completely or for a single component, only ? */
};
#define RALH_TYPE_PIXEL (0L) /* 8/24 bit: (non)transparacy value for each pixel */
#define RALH_TYPE_CMAP (1L) /* upto 8 Bit, only: supplies another colormap */
#define RALH_TRANS_ALL (0L) /* one 0.255 value for all components */
#define RALH_TRANS_COMPONENT (1L) /* one 0.255 value for each, separate component */
RGFX - Other chunks
===================
- NAME, AUTH, ANNO and (C) chunks are allowed